const url = 'http://localhost:9090'
import axios from "axios";
class reqConfig {
    constructor(name, age) {
        this.name = name
        this.age = age
    }
}
class resConfig {
    constructor(name, age) {
        this.name = name
        this.age = age
    }
}
class MyRequest {
    async post(params) {
        const { name: name1, age: age1 } = params
        const reqParams = new reqConfig(name1, age1)
        // console.log(reqParams)
        const res = await axios.post(`${url}/login`, reqParams)
        // console.log(res.data)
        const { name, age } = res.data
        const info = new resConfig(name, age)
        const infoProxy = new Proxy(info, {
            get(target, key) {
                console.log('代理', target, key)
                return target[key]
            },
            set(target, key, value) {
                console.log(target, key, value)
                return true
            },
        })
        return infoProxy
    }
}
const Request = new MyRequest()
export { Request, reqConfig, resConfig }